
export const chinesePattern = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/

export const amountPattern = /^\d+(\.?\d{1,2})?$/

export const phonePattern = /^1[3-9]\d{9}$/

export const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

export const blogRules = {
  title: [
    { required: true, message: '请输入博客标题', trigger: 'change' }
  ],
  category: [
    { required: true, message: '请输入或选择博客分类', trigger: 'change' },
    // { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' },
    { min: 1, max: 10, message: '请输入10字以内的类别', trigger: 'blur' }]
}

export const loginRules = {
  username: [
    { required: true, message: '请输入账号', trigger: 'blur' },
    { pattern: /^[0-9a-zA-Z]+$/, message: '请输入正确的格式: 数字或英文字母', trigger: ['blur'] }
  ],
  password: [
    { required: true, message: '请输入密码', trigger: 'blur' },
    { pattern: /^[0-9a-zA-Z]+$/, message: '请输入正确的格式: 数字或英文字母', trigger: ['blur'] }
  ],
  phoneNumber: [
    { required: true, message: '请输入手机号', trigger: 'blur' },
    { pattern: phonePattern, message: '请输入正确的手机号格式', trigger: ['blur'] }
  ],
  email: [
    { required: true, message: '请输入邮箱地址', trigger: 'blur' },
    { pattern: emailPattern, message: '请输入正确的邮箱格式', trigger: ['blur'] }
  ],
  code: [
    { required: true, message: '请输入验证码', trigger: 'blur' },
    { pattern: /^\d{6}$/, message: '请输入6位数字验证码', trigger: ['blur'] }
  ]
}

export const billRecordRules = {
  bookName: [
    { required: true, message: '请选择账本类型', trigger: 'change' }
  ],
  type: [
    { required: true, message: '请选择账单类别', trigger: 'change' }
  ],
  category: [
    { required: true, message: '请选择账单分类', trigger: 'change' }
  ],
  date: [
    { required: true, message: '请选择账单时间', trigger: 'change' }
  ],
  payAccount: [
    { required: true, message: '请选择账单账户', trigger: 'change' }
  ],
  amount: [
    { required: true, message: '请输入账单金额', trigger: 'change' },
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ],
  location: [

  ],
  content: [
    { required: true, message: '请输入账单内容', trigger: 'change' }
  ]
}

export const billPayRules = {
  name: [
    { required: true, message: '请输入账户名称', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  icon: [
    { required: true, message: '请输入账户图标', trigger: 'blur' }
  ],
  color: [
    { required: true, message: '请输入图标颜色', trigger: 'change' }
  ]
}

export const billBookRules = {
  name: [
    { required: true, message: '请输入账本名称', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  icon: [
    { required: true, message: '请输入账本图标', trigger: 'blur' }
  ],
  color: [
    { required: true, message: '请输入图标颜色', trigger: 'change' }
  ]
}

export const billCategoryRules = {
  bookName: [
    { required: true, message: '请选择账本类型', trigger: 'change' }
  ],
  name: [
    { required: true, message: '请输入类别名称', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  type: [
    { required: true, message: '请选择类型名称', trigger: 'change' }
  ],
  icon: [
    { required: true, message: '请输入类别图标', trigger: 'blur' }
  ],
  color: [
    { required: true, message: '请输入图标颜色', trigger: 'change' }
  ]
}

export const budgetRules = {
  category: [
    { required: true, message: '请输入或选择预算类别', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  project: [
    { required: true, message: '请输入预算项目', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  content: [
    { required: true, message: '请输入预算内容', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  vendor: [
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  budget: [
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ],
  actual: [
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ],
  remake: [
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ]
}

export const foodRules = {
  name: [
    { required: true, message: '请输入名称', trigger: 'blur' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  category: [
    { required: true, message: '请选择菜系', trigger: 'change' }
  ]
}

export const foodMaterialRules = {
  type: [
    { required: true, message: '请选择类型', trigger: 'change' }
  ],
  name: [
    { required: true, message: '请输入名称', trigger: 'blur' }
  ],
  amount: [
    { required: true, message: '请输入分量', trigger: 'blur' }
  ]
}

export const foodStepRules = {
  content: [
    { required: true, message: '请输入内容', trigger: 'blur' }
  ]
}

export const foodRecordRules = {
  name: [
    { required: true, message: '请选择菜谱名称', trigger: 'change' }
  ],
  date: [
    { required: true, message: '请选择完成时间', trigger: 'change' }
  ],
  person: [
    { required: true, message: '请选择完成人', trigger: 'change' }
  ]
}

export const travelRules = {
  area: [
    { required: true, message: '请选择景点地区', trigger: 'change' }
  ],
  name: [
    { required: true, message: '请输入景点名称', trigger: 'change' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  address: [
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  price: [
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ]
}

export const travelRecordRules = {
  name: [
    { required: true, message: '请选择景点名称', trigger: 'change' }
  ],
  date: [
    { required: true, message: '请选择旅行日期', trigger: 'change' }
  ],
  persons: [
    { required: true, message: '请输入旅行人', trigger: 'blur' }
  ]
}

export const planRules = {
  title: [
    { required: true, message: '请输入标题', trigger: 'blur' }
  ],
  email: [
    { pattern: emailPattern, message: '请输入正确的邮箱格式', trigger: ['blur'] }
  ]
}

export const anniversaryRules = {
  title: [
    { required: true, message: '请输入标题', trigger: 'blur' }
  ],
  date: [
    { required: true, message: '请选择日期', trigger: 'change' }
  ],
  recurring: [
    { required: true, message: '请选择是否重复', trigger: 'change' }
  ],
  type: [
    { required: true, message: '请选择类型', trigger: 'change' }
  ]
}

export const productRules = {
  name: [
    { required: true, message: '请输入物品名称', trigger: 'blur' }
  ],
  price: [
    { required: true, message: '请输入物品价格', trigger: 'change' }
  ],
  purchaseDate: [
    { required: true, message: '请选择购买日期', trigger: 'change' }
  ],
  purchaser: [
    { required: true, message: '请选择购买人', trigger: 'change' }
  ]
}

export const journalRules = {
  content: [
    { required: true, message: '请输入内容', trigger: 'blur' }
  ],
  date: [
    { required: true, message: '请选择日期', trigger: 'change' }
  ]
}

export const kpiRules = {
  patientName: [
    { required: true, message: '请输入患者名称', trigger: 'blur' }
  ],
  date: [
    { required: true, message: '请选择日期', trigger: 'change' }
  ],
  project: [
    { required: true, message: '请输入项目', trigger: 'change' }
  ],
  price: [
    { required: true, message: '请选择价格', trigger: 'change' }
  ]
}

export const assetRules = {
  category: [
    { required: true, message: '请选择类型', trigger: 'change' }
  ],
  name: [
    { required: true, message: '请输入/选择名称', trigger: 'change' },
    { pattern: new RegExp(chinesePattern), message: '请输入中英文或数字' }
  ],
  owner: [
    { required: true, message: '请选择所属人', trigger: 'change' }
  ],
  amount: [
    { required: true, message: '请输入金额', trigger: 'change' },
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ]
}

export const ledgerRules = {
  book: [
    { required: true, message: '请输入账本名称', trigger: 'blur' }
  ],
  category: [
    { required: true, message: '请输入类别', trigger: 'blur' }
  ],
  content: [
    { required: true, message: '请输入内容', trigger: 'blur' }
  ],
  price: [
    { required: true, message: '请输入金额', trigger: 'change' },
    { pattern: new RegExp(amountPattern), message: '请输入正确的金额（最多两位小数）' }
  ],
  number: [
    { required: true, message: '请输入数量', trigger: 'blur' }
  ],
  unit: [
    { required: true, message: '请输入单位', trigger: 'blur' }
  ],
  payer: [
    { required: true, message: '请输入付款人', trigger: 'blur' }
  ]
}

export const passwordRules = {
  title: [
    { required: true, message: '请输入标题', trigger: 'blur' }
  ],
  username: [
    { required: true, message: '请输入账号', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请输入密码', trigger: 'blur' }
  ],
  owner: [
    { required: true, message: '请选择所属人', trigger: 'change' }
  ]
}

export const accountRules = {
  accountName: [
    { required: true, message: '请输入账号名称', trigger: 'blur' }
  ],
  username: [
    { required: true, message: '请输入用户姓名', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请输入账号密码', trigger: 'blur' },
    { min: 6, max: 20, message: '请输入6~20位的密码', trigger: 'change' }
  ],
  confirmPassword: [
    { required: true, message: '请输入确认密码', trigger: 'blur' },
    { min: 6, max: 20, message: '请输入6~20位的密码', trigger: 'change' }
  ]
}

export const profileInfoRules = {
  username: [
    { required: true, message: '请输入用户姓名', trigger: 'blur' }
  ],
  phoneNumber: [
    { pattern: phonePattern, message: '请输入正确的手机号格式', trigger: ['blur'] }
  ],
  email: [
    { pattern: emailPattern, message: '请输入正确的邮箱格式', trigger: ['blur'] }
  ]
}

export const profilePasswordRules = {
  oldPassword: [
    { required: true, message: '请输入旧密码', trigger: 'blur' },
    { min: 6, max: 20, message: '请输入6~20位的密码', trigger: 'change' }
  ],
  newPassword: [
    { required: true, message: '请输入新密码', trigger: 'blur' },
    { min: 6, max: 20, message: '请输入6~20位的密码', trigger: 'change' }
  ],
  confirmPassword: [
    { required: true, message: '请输入确认密码', trigger: 'blur' },
    { min: 6, max: 20, message: '请输入6~20位的密码', trigger: 'change' }
  ]
}
